package com.ldu.exam.dao;

import java.io.Serializable;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.ldu.exam.model.TestQuestionModel;

public interface TestQuestionRepository extends JpaRepository<TestQuestionModel, Serializable>,JpaSpecificationExecutor<TestQuestionModel> 
{
	@Query(value="select * from t_question a where a.type =?1",nativeQuery=true)
	Page<TestQuestionModel> findByTypeId(String typeId,Pageable page);
	
	Page<TestQuestionModel> findByTitleContaining(String name ,Pageable page);
	
	@Modifying
	@Query(nativeQuery=true,value="delete from rel_question_paper where paper_id =?1")
	void removeRelquestions(String id);
}
